﻿@model HomeViewModel

@{
	Layout = "~/Views/Shared/_Layout.cshtml";
	ViewBag.Title = "Blog";
	ViewBag.Description = "Insert description here...";
	var columnCount = 4;
	var rowCount = Model.PublicBlogs.Count() % columnCount;
}

<div class="row">
	<div class="span12">
		@if (Model.PublicBlogs.Any())
		{
			for (var i = 0; i <= rowCount; i++)
			{
				<ul class="thumbnails">
					@foreach (var blog in Model.PublicBlogs.Skip(i * columnCount).Take(columnCount))
					{
						<li class="span3">
							<div class="thumbnail">
								<a href="@blog.Url" title="@blog.Title">
									<img src="http://placehold.it/300x200" alt="@blog.Title">
								</a>
								<h3>
									@Html.Link(blog.Title, blog.Url)
								</h3>
								<p>@blog.Subtitle</p>
							</div>
						</li>
					}
				</ul>
			}
		}
		else
		{
			<p>
				No results found.
			</p>
		}
	</div>
</div>